package com.woniuxy.microfixeddepositserver.dao;


import com.woniuxy.bean.bank.BankBean;
import com.woniuxy.microfixeddepositserver.bean.FundManagerBean;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface FundManagerDao {


    /**
     * 查询基金经理信息
     */
    @Select("select id mid,name mname,avatar,gmt_create gmtCreate,education_level educationLevel,background," +
            " calls,graduateSchool,department,self_introduction selfIntroduction" +
            " from  fund_manager where status=1 order by gmt_create desc")
    List<FundManagerBean> selectAll ();

    @Insert("insert fund_manager(name,avatar,gmt_create,education_level,background,calls,graduateSchool,department,self_introduction) " +
            "values(#{mname},#{avatar},NOW(),#{educationLevel},#{background},#{calls},#{graduateSchool},#{department},#{selfIntroduction})")
    void addManager (FundManagerBean fundManagerBean);

    int deleteByPrimaryKey (Integer mid);

    int updateByPrimaryKey (FundManagerBean fundManagerBean);

    @Select("select id mid,name mname,avatar,education_level educationLevel,background," +
            " calls,graduateSchool,department,self_introduction selfIntroduction from  fund_manager where id=#{id} and status=1")
    FundManagerBean getManagerById (Integer id);

    @Select("select id mid,name mname,avatar,education_level educationLevel,background," +
            " calls,graduateSchool,department,self_introduction selfIntroduction from  fund_manager where name like #{mname} and status=1")
    List<FundManagerBean> findByName (String mname);
}